﻿#include "smallwidget.h"
#include "ui_smallwidget.h"

SmallWidget::SmallWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SmallWidget)
{
    ui->setupUi(this);
    //QSpinBox移动 QSlider跟着移动
    void(QSpinBox:: * spSingal)(int) = &QSpinBox::valueChanged;
    connect(ui->spinBox,spSingal,ui->horizontalSlider,&QSlider::setValue);

    //QSlider滑动 QSpinBox移动
    connect(ui->horizontalSlider,&QSlider::valueChanged,ui->spinBox,&QSpinBox::setValue);


}
int SmallWidget::get_num()
{
    return ui->spinBox->value();
}
void SmallWidget::set_num(int num)
{
    ui->spinBox->setValue(num);
}
SmallWidget::~SmallWidget()
{
    delete ui;
}
